Skip to content
This repository has been archived by the owner on May 15, 2021. It is now read-only.

ROGUE v2 (Sourcery refactored) #78

Merged
merged 1 commit into from
Nov 29, 2020
Merged

ROGUE v2 (Sourcery refactored) #78

merged 1 commit into from
Nov 29, 2020

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Nov 29, 2020

Pull Request #77 refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the release branch, then run:

git fetch origin sourcery/release
git merge --ff-only FETCH_HEAD
git reset HEAD^

@sourcery-ai sourcery-ai bot requested a review from code-rgb November 29, 2020 06:07
while done is False:
while not done:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function _GDrive._download_file refactored with the following changes:

  • Simplify comparison to boolean (simplify-boolean-comparison)

Comment on lines -759 to +763
out = (found.group(1), "folder")
return found.group(1), "folder"
elif found:
out = (found.group(1), "file")
return found.group(1), "file"
else:
out = (link, "unknown")
return out
return link, "unknown"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Worker._get_file_id refactored with the following changes:

  • Lift return into if (lift-return-into-if)

Comment on lines -936 to +935
file_path = dl_loc if dl_loc else self._message.input_str
file_path = dl_loc or self._message.input_str
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Worker.upload refactored with the following changes:

  • Remove redundant conditional (remove-redundant-if)
  • Simplify if expression by using or (or-if-exp-identity)

Comment on lines -997 to +996
elif self._output is not None and self._is_canceled:
elif self._output is not None:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Worker.download refactored with the following changes:

  • Remove redundant conditional (remove-redundant-if)

Comment on lines -1028 to +1027
elif self._output is not None and self._is_canceled:
elif self._output is not None:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Worker.copy refactored with the following changes:

  • Remove redundant conditional (remove-redundant-if)

@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Nov 29, 2020

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.16%.

Quality metrics Before After Change
Complexity 6.90 ⭐ 6.76 ⭐ -0.14 👍
Method Length 63.12 🙂 62.91 🙂 -0.21 👍
Working memory 11.46 😞 11.43 😞 -0.03 👍
Quality 63.77% 🙂 63.93% 🙂 0.16% 👍
Other metrics Before After Change
Lines 1285 1284 -1
Changed files Quality Before Quality After Quality Change
userge/plugins/misc/gdrive.py 63.77% 🙂 63.93% 🙂 0.16% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
userge/plugins/misc/gdrive.py _GDrive._search 25 😞 237 ⛔ 23 ⛔ 21.02% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userge/plugins/misc/gdrive.py _GDrive._upload_file 14 🙂 291 ⛔ 33 ⛔ 24.43% ⛔ Try splitting into smaller methods. Extract out complex expressions
userge/plugins/misc/gdrive.py Worker.upload 27 😞 308 ⛔ 11 😞 28.74% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
userge/plugins/misc/gdrive.py _GDrive._download_file 5 ⭐ 205 ⛔ 30 ⛔ 37.55% 😞 Try splitting into smaller methods. Extract out complex expressions
userge/plugins/misc/gdrive.py Worker.copy 12 🙂 161 😞 10 😞 50.29% 🙂 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

@code-rgb code-rgb merged commit 4cf3a05 into release Nov 29, 2020
@code-rgb code-rgb deleted the sourcery/release branch November 29, 2020 07:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant